package com.complex.spring.advance.service.event;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;

/**
 * 自定义事件监听器  与java中不同的是,它不再是接口,而直接是实现类
 * @see com.complex.spring.advance.service.messagesource.MethodExecutionEventListener
 * @author gao
 *
 */
public class MethodExecutionEventListener implements ApplicationListener {

	@Override
	//这里使用MethodExecutionEvent作为参数可能更合适些
	public void onApplicationEvent(ApplicationEvent event) {
		if(event instanceof MethodExecutionEvent){
			MethodExecutionEvent eventMethod = (MethodExecutionEvent)event;
			System.out.println("onApplicationEvent=======>"+eventMethod.getMethodExecutionStatus());
		}
	}
	
}
